package com.wangdao.wechatmall.controller.wx;

import com.wangdao.wechatmall.bean.bo.wx.TopicListBo;
import com.wangdao.wechatmall.bean.pojo.Topic;
import com.wangdao.wechatmall.bean.vo.admin.BaseDataVO;
import com.wangdao.wechatmall.bean.vo.admin.BaseRespVo;
import com.wangdao.wechatmall.bean.vo.wx.BaseDataListVO;
import com.wangdao.wechatmall.bean.vo.wx.BaseDateTopicVO;
import com.wangdao.wechatmall.service.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ShuiYi
 * @time 2021-07-12 14:48
 */
@RestController
@RequestMapping("wx/topic")
public class WXTopicController {

    @Autowired
    TopicService topicService;
    @RequestMapping("list")
    public BaseRespVo topicList(TopicListBo topicListBo) {
        BaseDataListVO baseDataVO = topicService.topicList(topicListBo);
        return BaseRespVo.ok(baseDataVO);
    }

    @RequestMapping("detail")
    public BaseRespVo topicDetail(Integer id) {
        BaseDateTopicVO baseDateTopicVO = topicService.topicDetail(id);
        return BaseRespVo.ok(baseDateTopicVO);
    }


    @RequestMapping("related")
    public BaseRespVo topicRelated(Integer id) {
        List<Topic> topicList = topicService.topicRelated(id);
        return BaseRespVo.ok(topicList);
    }
}
